<%@ page contentType="text/html;charset=UTF-8" errorPage="500.jsp" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登陆页面</title>
    <script>
        /*
        * 点击图片或者超链接进行图片更换
        * 1. 给图片和超链接绑定事件
        * 2. 重新设置图片的src值
        */
        window.onload = function () {
            //1. 获取图片对象
            var img = document.getElementById("img");
            //2. 绑定单击事件
            img.onclick = function () {
                //加时间戳
                var data = new Date().getTime();
                img.src = "/web02/checkCodeServlet?" + data;
            }
        }
    </script>
    <style>
        div{
            color: #ff0000;
        }
    </style>
</head>
<body>
<form method="get" action="login">
    <table>
        <tr>
            <td>用户名：</td>
            <td> <input type="text" name="username"></td>
        </tr>
        <tr>
            <td>密 码：</td>
            <td><input type="password" name="password"></td>
        </tr>
        <tr>
            <td>验证码:</td>
            <td><input type="text" name="checkCode"></td>
        </tr>
        <tr>
            <td colspan="2"><img id="img" src="/web02/checkCodeServlet" alt=""></td>
        </tr>
        <tr>
            <td colspan="2"><input type="submit" value="登录"></td>
        </tr>
    </table>

</form>
<div><%=request.getAttribute("error") == null ?"":request.getAttribute("error")%></div>
<div><%=request.getAttribute("err")== null ?"":request.getAttribute("err")%></div>
</body>
</html>